IMU

IMU measures and informs about velocity, attitude and forces by combining the accelerometer and gyroscope readings.

Veronte Autopilot 1x needs to receive 7 measurements: 3-axis accelerometer, 3-axis gyroscope and sensor device temperature.

In the S-function there are 3 inputs for IMUs. These IMUs are mounted differently on the Autopilot 1x (they may not be aligned with the autopilot), so the user has to keep in mind the rotation matrix that the Autopilot 1x is using.

Important

  • The rotation matrices listed in the following table are the required rotations between each sensor and the Autopilot 1x board coordinates (for more information on the Veronte Autopilot 1x coordinates, please check the Orientation - Hardware Installation section of the 1x Hardware Manual).

  • Please note that, the number of inputs (ports) correspond to the maximum number of inputs available on all hardware versions, as can be seen in the following table.

  • As detailed in the table below, if users wish to enter measurements into the IMU 3 with hardware version 4.8, they must enter them into the IMU0 input.

    This is because the block input values belonging to IMU0 also go internally to this IMU. Therefore, the same S-Function can be used for both hardware version 4.0 and 4.8.

Hardware version

IMU

Rotation Matrix

4.0

IMU0

\(R =\begin{pmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & -1 \end{pmatrix}\)

IMU1

\(R =\begin{pmatrix} 0 & 0 & -1 \\ 1 & 0 & 0 \\ 0 & -1 & 0 \end{pmatrix}\)

4.5

IMU0

\(R =\begin{pmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & -1 \end{pmatrix}\)

IMU1

\(R =\begin{pmatrix} 0 & 0 & -1 \\ 1 & 0 & 0 \\ 0 & -1 & 0 \end{pmatrix}\)

IMU2

\(R =\begin{pmatrix} 0 & -1 & 0 \\ -1 & 0 & 0 \\ 0 & 0 & -1 \end{pmatrix}\)

4.8

IMU3

Note

IMU3 corresponds to IMU0 input as explained in the previous note

\(R =\begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & -1 & 0 \end{pmatrix}\)

IMU1

\(R =\begin{pmatrix} -1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{pmatrix}\)

IMU2

\(R =\begin{pmatrix} -1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{pmatrix}\)

Within the S-Function, the introduced data is transformed to match the coordinates of the Veronte Autopilot 1x. So, in order to be correctly transformed inside the S-Function, the data must have been previously “prepared” to be introduced into it in the following way:

\[data_{(input)} = (Sensor \, rotation \, matrix)^T \cdot data_{(board)}\]

In the example provided by Embention with the SIL package, the simin_IMU0 block already has this transformation implemented, so it can be entered directly into the S-Function without prior “preparation”.

There are several ways to implement a suitable read group for an IMU:

  • Constant value

    The user can create a vector with constant values.


  • From Workspace block

    Another option could be to store some data (i.e. from a previous flight), load it into the matlab workspace, and then send these values to Simulink using the block name as From Workspace.

    ../../../_images/imu.png

    IMU - From workspace blocks

    This block allows the user to read from an array of values (and interpolate when there is no information in this step). Moreover, users can choose between several options in case data vector is over. For example, it is possible to extrapolate the information or reset the list of values.

    ../../../_images/imu_from_workspace.jpg

    From workspace block configuration


  • Complex model

    Another method is to read these values from Environment (gravity vector in NED frame and air temperature) and from States (acceleration in body axes, angular velocity, angular acceleration and the rotation matrix from NED to Body).

    These values are fed into a Matlab function in which the IMU behaviour is simulated and the measurements are computed. In addition, users have to cross-reference the measurements or apply a rotation matrix depending on the orientation of the IMU sensor.

    In the example below, this data feeds the first port (this IMU is selected in the 1x PDI Builder configuration). Therefore, the user has to cross the signals to adjust the rotation matrix.

    The complete subsystem results as follows:

    ../../../_images/imu_environment.png

    IMU - Subsystem

    ../../../_images/imu_accelerometer_pdi_builder.png

    IMU - Accelerometer selected in 1x PDI Builder

    ../../../_images/imu_gyroscope_pdi_builder.png

    IMU - Gyroscope selected in 1x PDI Builder

    However, instead of using a user function, Aerospace blockset includes some functions for IMU simulation that can be employed:

    ../../../_images/imu_aeroespace.png

    IMU - Aerospace Toolbox block

  • Specific example from the example provided by Embention

    The data in the example provided is already prepared for being introduced into the S-Function as the IMU 0 data, that is the IMU0 sensor in hardware version 4.0.

    Therefore, if users want to use the data provided by Embention (simin_IMU0) and in their configuration with a 4.8 hwv they have the IMU 3 selected, the following transformations are necessary for correct operation:


    1. Transform from IMU 0 to board coordinates

      Undo the “preparation for input” (this “preparation” has been described at the beginning of the section) to obtain the data provided by the sensor in body coordinates:

      \[\begin{split}data_{(board)} = \begin{pmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & -1 \end{pmatrix} \cdot data_{(example)}\end{split}\]
      • \(data_{(example)}\) is the data inside the simin_IMU0 block

    2. Transform from board to IMU 3 coordinates

      Prepare the data for conversion to IMU 3 coordinates by multiplying the sensor body data by the IMU 3 rotation matrix transpose:

      \[\begin{split}data_{(input)} = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \end{pmatrix} \cdot data_{(board)}\end{split}\]

    Finally, the whole transformation should look like this:

    ../../../_images/imu_example_embention.png

    IMU - Example